<?php


/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

$_MAMBOTS->registerFunction( 'onAfterGetEmailContent', 'plgHelpDeskReplyaboveline_onAfterGetEmailContent' );

	/**
	 * Do the plugin
	 * @return 
	 */
	function plgHelpDeskReplyaboveline_onAfterGetEmailContent( $ticket, &$content ) {
		$return = plgHelpDeskReplyaboveline::onAfterGetEmailContent( $ticket, $content );
		return $return;
	}

class plgHelpDeskReplyaboveline 
{
	/**
	 *
	 * Method is called before sending emails
	 * 
	 * Note: 
	 * $content['subject'] and $content['body']
	 * are available
	 *
	 */
	function onAfterGetEmailContent( $ticket, &$content ) 
	{
		$mainframe = HelpDeskConfig::getApplication();
		$success = true;
		$return = new stdClass();
		
		// needs to be flush left, i think
		$return->body  = '
-! '.HelpDeskText::_( 'Reply Above' ).' !-  
{ticketid:'.$ticket->id.'}

'.
HelpDeskText::_( 'Original Comment Follows' ).'
--
';
		$return->body .= $content->body;
		$return->subject = $content->subject;
		
		$content = $return;
		
		return $success;
	}
	
}